package com.project.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dtyunxi.rest.PageData;
import com.dtyunxi.rest.RestResponse;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.project.entity.activity.Activity;
import com.project.service.IActivityService;
import com.project.util.BaseService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

@RestController
@RequestMapping("api/test")
@Api(value = "api/test", description = "测试管理")
public class TestController {
	
	@Autowired
	private IActivityService activityService;
	
	@ApiOperation(value = "活动列表", notes = "活动列表", response = Activity.class)
	@ApiResponses(value = { @ApiResponse(code = 200, message = "活动列表", response = Activity.class) })
    @RequestMapping(value = "list", method = RequestMethod.GET)
    public RestResponse activityList(@RequestParam(defaultValue = "1", required = false) int pageNo,
            @RequestParam(defaultValue = "5", required = false) int pageSize){
        PageData page = new PageData();
        Activity activity = new Activity();
//        List<Activity> list = activityService.queryPageData(activity, pageSize, pageNo);
        int total = activityService.queryCount(activity);
//        page = BaseService.listVoToPageData(pageNo, pageSize, list, total);
        
        
        List<Activity> list = activityService.queryPageData(activity, pageSize, pageNo);
        return new RestResponse(page);
    }

}
